﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Init {
    import flash.events.*;
    import Engine.Init.*;

    public class ActionQueue {

        protected var m_theQ:Array;

        public function ActionQueue(){
            this.m_theQ = new Array();
        }
        public function add(_arg1:InitializationAction):void{
            this.m_theQ.push(_arg1);
        }
        public function execute():void{
            this.doNextAction();
        }
        public function cancel():void{
            this.m_theQ = new Array();
        }
        protected function onActionCompleted(_arg1:Event=null):void{
            this.doNextAction();
        }
        protected function doNextAction():void{
            var _local1:InitializationAction;
            if (this.m_theQ.length > 0){
                _local1 = this.m_theQ.shift();
                _local1.addEventListener(Event.COMPLETE, this.onActionCompleted);
                _local1.execute();
            };
        }

    }
}//package Init 
